home *** CD-ROM | disk | FTP | other *** search
- import javax.microedition.lcdui.Command;
- import javax.microedition.lcdui.CommandListener;
- import javax.microedition.lcdui.Displayable;
- import javax.microedition.lcdui.Form;
-
- public class MessageDetails extends Form implements CommandListener {
- private MicroMail midlet;
- private MessageList parent;
- private int activeBoxId;
- private int activeMsgId;
- private Message message;
- Command backCommand;
- Command editCommand;
- Command replyCommand;
- Command deleteCommand;
- Command markunreadCommand;
-
- public MessageDetails(MicroMail var1, MessageList var2, int var3, int var4) {
- super(MicroMail.r.getText(25));
- this.backCommand = new Command(MicroMail.r.getText(1), 2, 6);
- this.editCommand = new Command(MicroMail.r.getText(5), 1, 1);
- this.replyCommand = new Command(MicroMail.r.getText(6), 1, 2);
- this.deleteCommand = new Command(MicroMail.r.getText(3), 1, 3);
- this.markunreadCommand = new Command(MicroMail.r.getText(8), 1, 5);
- this.midlet = var1;
- this.parent = var2;
- this.activeBoxId = var3;
- this.activeMsgId = var4;
- this.message = MicroCache.getMessage(this.activeBoxId, this.activeMsgId);
- ((Displayable)this).setCommandListener(this);
- ((Displayable)this).addCommand(this.backCommand);
- if (this.activeBoxId == 2) {
- ((Displayable)this).addCommand(this.editCommand);
- }
-
- if (this.activeBoxId == 1) {
- ((Displayable)this).addCommand(this.replyCommand);
- }
-
- ((Displayable)this).addCommand(this.deleteCommand);
- ((Displayable)this).addCommand(this.markunreadCommand);
- this.displayMessage();
- MicroCache.markRead(this.activeBoxId, this.message, this.activeMsgId, true);
- this.parent.updateItem(this.activeMsgId, this.message.subject, true);
- }
-
- public void commandAction(Command var1, Displayable var2) {
- if (var1 == this.backCommand) {
- MicroMail.display.setCurrent(this.parent);
- } else if (var1 == this.editCommand) {
- MessageForm var3 = new MessageForm(this.midlet, this.parent, this.message, this.activeMsgId);
- MicroMail.display.setCurrent(var3);
- } else if (var1 == this.replyCommand) {
- String var5 = this.message.to;
- if (this.message.replyTo != null && this.message.replyTo.length() > 0) {
- this.message.to = this.message.replyTo;
- } else {
- this.message.to = this.message.from;
- }
-
- this.message.from = var5;
- this.message.body = "";
- this.message.ID = -1;
- MessageForm var4 = new MessageForm(this.midlet, this, this.message, -1);
- MicroMail.display.setCurrent(var4);
- } else if (var1 == this.deleteCommand) {
- MicroCache.deleteMessage(this.activeBoxId, this.activeMsgId, this.message);
- this.parent.deleteItem(this.activeMsgId);
- MicroMail.display.setCurrent(this.parent);
- } else if (var1 == this.markunreadCommand) {
- MicroCache.markRead(this.activeBoxId, this.message, this.activeMsgId, false);
- this.parent.updateItem(this.activeMsgId, this.message.subject, false);
- MicroMail.display.setCurrent(this.parent);
- }
-
- MicroMail.dispose(this);
- }
-
- public void displayMessage() {
- if (this.activeBoxId != 1 && this.activeBoxId != 4) {
- ((Form)this).append(MicroMail.r.getText(26) + this.message.to + "\r\n");
- ((Form)this).append(MicroMail.r.getText(29) + this.message.subject + "\r\n");
- ((Form)this).append(MicroMail.r.getText(30) + this.message.body + "\r\n");
- } else {
- ((Form)this).append(MicroMail.r.getText(27) + this.message.from + "\r");
- ((Form)this).append(MicroMail.r.getText(26) + this.message.to + "\r");
- ((Form)this).append(MicroMail.r.getText(28) + this.message.date + "\r");
- ((Form)this).append(MicroMail.r.getText(29) + this.message.subject + "\r");
- ((Form)this).append(MicroMail.r.getText(30) + this.message.body + "\r");
- }
-
- }
- }
-